<?php

namespace app\model\site;

use app\model\store\StoreManager;
use think\Model;
use think\model\concern\SoftDelete;


class User extends Model
{
    use SoftDelete;
    protected string $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;

    public function oauth(): \think\model\relation\HasMany
    {
        return $this->hasMany(UserOauth::class, 'user_id');
    }

    public function level(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(UserLevel::class, 'user_id');
    }

    public function parent(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(User::class, 'parent_id');
    }

    public function storeManager(): \think\model\relation\HasOne
    {
        return $this->hasOne(StoreManager::class, 'user_id');
    }

}
